﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace dataSend
{
    public partial class LoginForm : DevComponents.DotNetBar.Office2007Form
    {
        public delegate void ProgressDelegate(BackgroundWorker bw);
        private MainForm mf = null;
        private ProgressDelegate pd = null;
        public LoginForm()
        {
            InitializeComponent();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
            mf = new MainForm();
            lbLoginState.Text = "登录服务器中,请稍后。。。";
           // pd = mf.initMainForm;
            backgroundWorker.RunWorkerAsync();
            }
            catch (Exception)
            {

                throw;
            }
        }

        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.Hide();
            mf.Show();
        }

        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            pd(backgroundWorker);
        }

        private void bgWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            this.progressBar.Value = e.ProgressPercentage;
        }
    }
}
